package lanou.autohome.forum.fragments;

import android.widget.ListView;

import lanou.autohome.URLValues;
import lanou.autohome.basetool.BaseFragment;
import lanou.autohome.R;
import lanou.autohome.basetool.NetTool;
import lanou.autohome.forum.adapters.ForumHotAdapter;
import lanou.autohome.forum.beans.ForumHotBean;

/**
 * Created by dllo on 16/8/15.
 * 论坛 -> 热帖
 */
public class ForumHotFragment extends BaseFragment {


    private ForumHotAdapter forumHotAdapter;
    private ListView listView;

    @Override
    protected int setLayout() {
        return R.layout.fragment_forum_hot;
    }

    @Override
    protected void initView() {
        listView = bindVie(R.id.listView_forum_hot);
    }

    @Override
    protected void intiData() {

        mNetTool.getNetData(URLValues.TOP_POSTS_URL, ForumHotBean.class, new NetTool.NetListener<ForumHotBean>() {
            @Override
            public void onSuccess(ForumHotBean forumHotBean) {
                forumHotAdapter =  new ForumHotAdapter(getContext());
                forumHotAdapter.setForumHotBean(forumHotBean);
                listView.setAdapter(forumHotAdapter);
            }

            @Override
            public void onError(String errorMsg) {

            }
        });
    }
}















